﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Yuyi.PluginForJS.JavaScriptLexer
{
    public static class Keywords
    {
        static readonly string[] keywordList = {
			"break",
            "false",
            "in",
            "this",
            "void",
            "continue",
            "for",
            "new",
            "true",
            "while",
            "delete",
            "function",
            "null",
            "typeof",
            "with",
            "else",
            "if",
            "return",
            "var",
            "case",
            "debugger",
            "export",
            "super",
            "catch",
            "default",
            "extends",
            "switch",
            "class",
            "do",
            "finally",
            "throw",
            "const",
            "enum",
            "import",
            "try"
		};

        static LookupTable keywords = new LookupTable(true);

        static Keywords()
        {
            for (int i = 0; i < keywordList.Length; ++i)
            {
                keywords[keywordList[i]] = i + Tokens.Break;
            }
        }

        public static int GetToken(string keyword)
        {
            return keywords[keyword];
        }
    }
}
